Skip to content

Fix FlopsProfiler crash when dp_world_size is None under sequence parallelism#8122

Merged
delock merged 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix/flops-profiler-dp-world-size-none
Jul 7, 2026
Merged

Fix FlopsProfiler crash when dp_world_size is None under sequence parallelism#8122
delock merged 1 commit into
deepspeedai:masterfrom
vineethsaivs:fix/flops-profiler-dp-world-size-none

Conversation

@vineethsaivs

Copy link
Copy Markdown
Contributor

Problem

When Ulysses sequence parallelism is enabled, the DeepSpeed engine reports dp_world_size as None (groups._get_data_parallel_world_size() returns None for a sequence-parallel mpu, because the data-parallel replication is folded into the sequence-data-parallel group).

FlopsProfiler.print_model_profile() formats that value with '{:<8}', and '{:<8}'.format(None) raises:

TypeError: unsupported format string passed to NoneType.__format__

so the profiler crashes on every profile step once sequence parallelism is on. This matches the traceback in #7483.

Fix

When dp_world_size is None, report seq_dp_world_size instead (the engine always sets it, and under sequence parallelism it is the effective data-parallel replication). The normal (non-sequence-parallel) path is unchanged.

Test

Added test_print_model_profile_with_none_dp_world_size in tests/unit/profiling/flops_profiler/test_flops_profiler.py. It drives print_model_profile with an engine whose dp_world_size is None. It fails on master with the NoneType.__format__ TypeError and passes with this change, asserting the sequence-data-parallel world size is shown for "data parallel size".

Fixes #7483

…allelism

When Ulysses sequence parallelism is enabled the DeepSpeed engine reports
dp_world_size as None, since the data-parallel replication is folded into the
sequence-data-parallel group. print_model_profile formatted that value with
'{:<8}', which raised 'unsupported format string passed to NoneType.__format__'
and crashed the profiler at every step. Report the sequence-data-parallel world
size when dp_world_size is None.

Fixes deepspeedai#7483

Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
@delock delock enabled auto-merge July 7, 2026 04:01
@delock delock added this pull request to the merge queue Jul 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 7, 2026
@vineethsaivs

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge @delock. Quick note on the merge-queue removal: the failing check was the yapf pre-commit hook crashing while loading its own grammar file (EOFError: Ran out of input from a truncated pickle in the runner's pre-commit cache), not anything in this diff. clang-format, flake8, codespell and the rest passed, and the PR's own formatting / formatting checks is green. The PR is green, mergeable and approved again now, so it should be safe to re-add to the merge queue whenever convenient.

@delock delock added this pull request to the merge queue Jul 7, 2026
Merged via the queue into deepspeedai:master with commit 6e38d56 Jul 7, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] FlopsProfiler will hit error when sequence parallel enabled

2 participants